package com.yuexi.domain.payment;

import com.yuexi.domain.bill.definds.PayByEnum;
import com.yuexi.domain.payment.alipay.AliPayDomain;
import com.yuexi.domain.payment.wxpay.WePayDomain;
import com.zenx.domain.Entity;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author jie
 * @date 2023/4/7 -15:33
 */
@Entity
public class PayDomain {

    @Autowired
    private WePayDomain wePayDomain;
    @Autowired
    private AliPayDomain aliPayDomain;

    /**
     * 获取支付方式
     * 微信、支付宝、或者都不是
     */
    public String getPayBy(String authCode) {
        if (wePayDomain.verifyAuthCode(authCode)) {
            return PayByEnum.WEPAY.name();
        } else if (aliPayDomain.verifyAuthCode(authCode)) {
            return PayByEnum.ALIPAY.name();
        } else {
            return null;
        }
    }
}
